#pragma once
#ifndef CALLSTABLE_H
#define CALLSTABLE_H

#include "spa_types.h"
#include <map>
#include <vector>
#include <set>

class CallsTable
{
private:
	map<PROCINDEX,set<PROCINDEX>> callerTable;
	map<PROCINDEX,set<PROCINDEX>> calleeTable;
	map<int,PROCINDEX> callStmtTable;
	void CallsTable::getByCallerIndexTHelper(PROCINDEX caller, set<int>* tempResult,int switchAddSelf);
	void CallsTable::getByCalleeIndexTHelper(PROCINDEX callee, set<int>* tempResult,int switchAddSelf);
public:
	static const int YES=1;
	static const int NO=0;
	CallsTable();
	~CallsTable();
	void InsertCalls(int stmt_num, PROCINDEX caller_proc, PROCINDEX callee_proc);
	PROCINDEX GetCalleeByStatement(int stmt_num);
	PROCINDEX_ARRAY GetCallee(PROCINDEX caller_proc);
	PROCINDEX_ARRAY RetrieveTransitiveCallee(PROCINDEX caller_proc);
	PROCINDEX_ARRAY GetCaller(PROCINDEX callee_proc);
	PROCINDEX_ARRAY RetrieveTransitiveCaller(PROCINDEX callee_proc);
};

#endif